<?php

use yii\db\Migration;
use yii\db\Schema;
/**
 * Class m180320_060821_CREATE_DB
 */
class m180320_060821_CREATE_DB extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {   
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        $this->createTable('card', [
            "id" =>         Schema::TYPE_PK,
            "card"      =>  Schema::TYPE_INTEGER.   "(6) DEFAULT  '0' COMMENT '区号'",
            "area"      =>  Schema::TYPE_STRING.    "(128) NULL COMMENT '地区名称'",
        ], $tableOptions);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        echo "m180320_060821_CREATE_DB cannot be reverted.\n";

        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m180320_060821_CREATE_DB cannot be reverted.\n";

        return false;
    }
    */
}
